+Tue Jan 15 12:23:33 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtknotebook.c (gtk_notebook_mnemonic_activate_switch_page):
+ focus the activated tab, not the page. (#53612)
+
+ * gtk/gtknotebook.c (gtk_notebook_set_focus_child): Track
+ the last focus descendant of the page.
+
+ * gtk/gtknotebook.c (gtk_notebook_real_switch_page): If the focus
+ was on the previous page, move it to the last focused widget /
+ first element on the new page, if possible, or if not, to the
+ notebook itself. (#68224, reported by Jonathan Blandford)
+
+ * gtk/gtknotebook.c (focus_tabs_in): Don't focus tabs
+ tabs aren't visible. (#65462, Damon Chaplin, fixed based
+ on patch from Anders Carlsson)
+
2002-01-15 Vitaly Tishkov <tvv@sparc.spb.su>
* gtk/gtkstyle.c
+Tue Jan 15 12:23:33 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtknotebook.c (gtk_notebook_mnemonic_activate_switch_page):
+ focus the activated tab, not the page. (#53612)
+
+ * gtk/gtknotebook.c (gtk_notebook_set_focus_child): Track
+ the last focus descendant of the page.
+
+ * gtk/gtknotebook.c (gtk_notebook_real_switch_page): If the focus
+ was on the previous page, move it to the last focused widget /
+ first element on the new page, if possible, or if not, to the
+ notebook itself. (#68224, reported by Jonathan Blandford)
+
+ * gtk/gtknotebook.c (focus_tabs_in): Don't focus tabs
+ tabs aren't visible. (#65462, Damon Chaplin, fixed based
+ on patch from Anders Carlsson)
+
2002-01-15 Vitaly Tishkov <tvv@sparc.spb.su>
* gtk/gtkstyle.c
+Tue Jan 15 12:23:33 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtknotebook.c (gtk_notebook_mnemonic_activate_switch_page):
+ focus the activated tab, not the page. (#53612)
+
+ * gtk/gtknotebook.c (gtk_notebook_set_focus_child): Track
+ the last focus descendant of the page.
+
+ * gtk/gtknotebook.c (gtk_notebook_real_switch_page): If the focus
+ was on the previous page, move it to the last focused widget /
+ first element on the new page, if possible, or if not, to the
+ notebook itself. (#68224, reported by Jonathan Blandford)
+
+ * gtk/gtknotebook.c (focus_tabs_in): Don't focus tabs
+ tabs aren't visible. (#65462, Damon Chaplin, fixed based
+ on patch from Anders Carlsson)
+
2002-01-15 Vitaly Tishkov <tvv@sparc.spb.su>
* gtk/gtkstyle.c
+Tue Jan 15 12:23:33 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtknotebook.c (gtk_notebook_mnemonic_activate_switch_page):
+ focus the activated tab, not the page. (#53612)
+
+ * gtk/gtknotebook.c (gtk_notebook_set_focus_child): Track
+ the last focus descendant of the page.
+
+ * gtk/gtknotebook.c (gtk_notebook_real_switch_page): If the focus
+ was on the previous page, move it to the last focused widget /
+ first element on the new page, if possible, or if not, to the
+ notebook itself. (#68224, reported by Jonathan Blandford)
+
+ * gtk/gtknotebook.c (focus_tabs_in): Don't focus tabs
+ tabs aren't visible. (#65462, Damon Chaplin, fixed based
+ on patch from Anders Carlsson)
+
2002-01-15 Vitaly Tishkov <tvv@sparc.spb.su>
* gtk/gtkstyle.c
+Tue Jan 15 12:23:33 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtknotebook.c (gtk_notebook_mnemonic_activate_switch_page):
+ focus the activated tab, not the page. (#53612)
+
+ * gtk/gtknotebook.c (gtk_notebook_set_focus_child): Track
+ the last focus descendant of the page.
+
+ * gtk/gtknotebook.c (gtk_notebook_real_switch_page): If the focus
+ was on the previous page, move it to the last focused widget /
+ first element on the new page, if possible, or if not, to the
+ notebook itself. (#68224, reported by Jonathan Blandford)
+
+ * gtk/gtknotebook.c (focus_tabs_in): Don't focus tabs
+ tabs aren't visible. (#65462, Damon Chaplin, fixed based
+ on patch from Anders Carlsson)
+
2002-01-15 Vitaly Tishkov <tvv@sparc.spb.su>
* gtk/gtkstyle.c
+Tue Jan 15 12:23:33 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtknotebook.c (gtk_notebook_mnemonic_activate_switch_page):
+ focus the activated tab, not the page. (#53612)
+
+ * gtk/gtknotebook.c (gtk_notebook_set_focus_child): Track
+ the last focus descendant of the page.
+
+ * gtk/gtknotebook.c (gtk_notebook_real_switch_page): If the focus
+ was on the previous page, move it to the last focused widget /
+ first element on the new page, if possible, or if not, to the
+ notebook itself. (#68224, reported by Jonathan Blandford)
+
+ * gtk/gtknotebook.c (focus_tabs_in): Don't focus tabs
+ tabs aren't visible. (#65462, Damon Chaplin, fixed based
+ on patch from Anders Carlsson)
+
2002-01-15 Vitaly Tishkov <tvv@sparc.spb.su>
* gtk/gtkstyle.c
+Tue Jan 15 12:23:33 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtknotebook.c (gtk_notebook_mnemonic_activate_switch_page):
+ focus the activated tab, not the page. (#53612)
+
+ * gtk/gtknotebook.c (gtk_notebook_set_focus_child): Track
+ the last focus descendant of the page.
+
+ * gtk/gtknotebook.c (gtk_notebook_real_switch_page): If the focus
+ was on the previous page, move it to the last focused widget /
+ first element on the new page, if possible, or if not, to the
+ notebook itself. (#68224, reported by Jonathan Blandford)
+
+ * gtk/gtknotebook.c (focus_tabs_in): Don't focus tabs
+ tabs aren't visible. (#65462, Damon Chaplin, fixed based
+ on patch from Anders Carlsson)
+
2002-01-15 Vitaly Tishkov <tvv@sparc.spb.su>
* gtk/gtkstyle.c
GtkWidget *child;
GtkWidget *tab_label;
GtkWidget *menu_label;
+ GtkWidget *last_focus_child; /* Last descendant of the page that had focus */
guint default_menu : 1; /* If true, we create the menu label ourself */
guint default_tab : 1; /* If true, we create the tab label ourself */
static gboolean
focus_tabs_in (GtkNotebook *notebook)
{
- if (notebook->cur_page)
+ if (notebook->show_tabs && notebook->cur_page)
{
gtk_widget_grab_focus (GTK_WIDGET (notebook));
case GTK_DIR_TAB_BACKWARD:
case GTK_DIR_UP:
/* Focus onto the tabs */
- if (notebook->show_tabs)
- return focus_tabs_in (notebook);
- else
- return FALSE;
+ return focus_tabs_in (notebook);
case GTK_DIR_DOWN:
case GTK_DIR_TAB_FORWARD:
case GTK_DIR_LEFT:
gtk_notebook_set_focus_child (GtkContainer *container,
GtkWidget *child)
{
- GtkNotebook *notebook;
+ GtkNotebook *notebook = GTK_NOTEBOOK (container);
+ GtkWidget *page_child;
+ GtkWidget *toplevel;
- g_return_if_fail (GTK_IS_NOTEBOOK (container));
+ /* If the old focus widget was within a page of the notebook,
+ * (child may either be NULL or not in this case), record it
+ * for future use if we switch to the page with a mnemonic.
+ */
+
+ toplevel = gtk_widget_get_toplevel (GTK_WIDGET (container));
+ if (toplevel && GTK_WIDGET_TOPLEVEL (toplevel))
+ {
+ page_child = GTK_WINDOW (toplevel)->focus_widget;
+ while (page_child)
+ {
+ if (page_child->parent == GTK_WIDGET (container))
+ {
+ GList *list = gtk_notebook_find_child (notebook, page_child, NULL);
+ GtkNotebookPage *page = list->data;
+
+ if (page->last_focus_child)
+ g_object_remove_weak_pointer (G_OBJECT (page->last_focus_child), (gpointer *)&page->last_focus_child);
+
+ page->last_focus_child = GTK_WINDOW (toplevel)->focus_widget;
+ g_object_add_weak_pointer (G_OBJECT (page->last_focus_child), (gpointer *)&page->last_focus_child);
+
+ break;
+ }
+
+ page_child = page_child->parent;
+ }
+ }
if (child)
{
g_return_if_fail (GTK_IS_WIDGET (child));
- notebook = GTK_NOTEBOOK (container);
-
notebook->child_has_focus = TRUE;
if (!notebook->focus_tab)
{
}
}
}
+
parent_class->set_focus_child (container, child);
}
page = list->data;
+ if (page->last_focus_child)
+ g_object_remove_weak_pointer (G_OBJECT (page->last_focus_child), (gpointer *)&page->last_focus_child);
+
if (GTK_WIDGET_VISIBLE (page->child) && GTK_WIDGET_VISIBLE (notebook))
need_resize = TRUE;
gtk_widget_set_child_visible (notebook->cur_page->child, TRUE);
+ /* If the focus was on the previous page, move it to the first
+ * element on the new page, if possible, or if not, to the
+ * notebook itself.
+ */
+ if (notebook->child_has_focus)
+ {
+ if (notebook->cur_page->last_focus_child &&
+ gtk_widget_is_ancestor (notebook->cur_page->last_focus_child, notebook->cur_page->child))
+ gtk_widget_grab_focus (notebook->cur_page->last_focus_child);
+ else
+ if (!gtk_widget_child_focus (notebook->cur_page->child, GTK_DIR_TAB_FORWARD))
+ gtk_widget_grab_focus (GTK_WIDGET (notebook));
+ }
+
gtk_widget_queue_resize (GTK_WIDGET (notebook));
g_object_notify (G_OBJECT (notebook), "page");
}
{
GtkNotebookPage *page = list->data;
+ gtk_widget_grab_focus (notebook); /* Do this first to avoid focusing new page */
gtk_notebook_switch_page (notebook, page, -1);
+ focus_tabs_in (notebook);
}
return TRUE;
page = g_new (GtkNotebookPage, 1);
page->child = child;
+ page->last_focus_child = NULL;
page->requisition.width = 0;
page->requisition.height = 0;
page->allocation.x = 0;